﻿using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace Elkomp {

	public partial class FormaSearch : Fak.FormInherit {
		//public SqlConnection con = new SqlConnection(@"Data Source=SPIRO\SQL;Initial Catalog=TestS;Integrated Security=True");
		//  public SqlCommand com = new SqlCommand();
		// public DataSet Db = new DataSet();
		//public SqlDataAdapter Adapter = new SqlDataAdapter();

		public int currentRow, currentColumn = -1;

		public string MainConnection { set; get; }

		public string SelectSql { set; get; }

		[DefaultValue( "t" )]
		public string Transakcija { set; get; }

		public string UpdateTable { set; get; }

		public FormaSearch() {
			//            MainConnection =  @"Data Source=" + registry.Read("Server") + ";Initial Catalog=" + registry.Read("Database") + ";Integrated Security=True";
			InitializeComponent();
			//
		}

		private void btnZatvori_Click( object sender, EventArgs e ) {
			Zatvori();
		}

		public void Zatvori() {
			this.Close();
		}

		public virtual void NovZapis( object sender, EventArgs e ) {
		}

		public virtual void IzmeniZapis( object sender, EventArgs e ) {
		}

		public virtual void IzbrisiZapis( object sender, EventArgs e ) {
		}

		private void пребарајToolStripMenuItem_Click( object sender, EventArgs e ) {
			btnPrebaraj.PerformClick();
		}

		private void FormaSearch_KeyPress( object sender, KeyPressEventArgs e ) {
		}

		public bool proveriPrivilegija( String Transakcija ) {
			if ( Transakcija.Contains( "t" ) ) {
				return true;
			} else {
				return false;
			}
		}

		private void FormaSearch_KeyDown( object sender, KeyEventArgs e ) {
			if ( e.KeyCode == Keys.F1 ) {
				новЗаписToolStripMenuItem.PerformClick();
			}
			if ( e.KeyCode == Keys.F2 ) {
				едитирајЗаписToolStripMenuItem.PerformClick();
			}
			if ( e.KeyCode == Keys.F3 ) {
				избришиЗаписToolStripMenuItem.PerformClick();
			}

			if ( e.KeyCode == Keys.F5 ) {
				пребарајToolStripMenuItem.PerformClick();
			}
			if ( e.KeyCode == Keys.F4 ) {
				затвориToolStripMenuItem.PerformClick();
			}
		}
	}
}